You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
import React from "react";
|
|
import Image from "next/image";
|
|
import { getFloorBySlug } from "../../../../lib/data";
|
|
import { ProductGrid } from "../../../../components/ProductGrid";
|
|
|
|
export const revalidate = 300;
|
|
|
|
export default function ChannelPage({ params }: { params: { locale: string; slug: string } }) {
|
|
const floor = getFloorBySlug(params.slug, params.locale);
|
|
if (!floor) {
|
|
return (
|
|
<div className="mx-auto max-w-screen-2xl px-4 py-12">
|
|
<h1 className="text-2xl font-semibold">Channel Not Found</h1>
|
|
<a className="mt-6 inline-block text-blue-600" href={`/${params.locale}`}>Back</a>
|
|
</div>
|
|
);
|
|
}
|
|
return (
|
|
<div className="mx-auto max-w-screen-2xl px-4 py-8 space-y-8">
|
|
<div className="flex items-center justify-between">
|
|
<h1 className="text-2xl font-semibold">{floor.title}</h1>
|
|
<a href={`/${params.locale}`} className="text-sm text-gray-600 hover:text-gray-900">{params.locale === 'en' ? 'Home' : '返回首页'}</a>
|
|
</div>
|
|
{floor.hero?.image && (
|
|
<a href={floor.hero.href ?? `/${params.locale}`} className="block overflow-hidden rounded-xl relative aspect-[16/6] w-full">
|
|
<Image
|
|
src={floor.hero.image}
|
|
alt={floor.hero.title ?? floor.title}
|
|
fill
|
|
sizes="100vw"
|
|
className="object-cover"
|
|
priority={false}
|
|
/>
|
|
</a>
|
|
)}
|
|
<ProductGrid items={floor.products} basePath={`/${params.locale}`} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
|
|
|